import request from '@/utils/request';

export function getAllDishes() {
    return request({
        url: '/dishes/getAllDishes',
        method: 'get'
    });
}


export function getTodayDishes() {
    return request({
        url: '/dishes/getTodayDishes',
        method: 'get'
    });
}

export function getAllDishesEvenDeleted() {
    return request({
        url: '/dishes/getAllDishesEvenDeleted',
        method: 'get'
    });
}
export function getDeletedDishes() {
    return request({
        url: '/dishes/getDeletedDishes',
        method: 'get'
    });
}

export function addNewDish(dishData) {
    return request({
        url: '/dishes/add',
        method: 'post',
        data: dishData // 传递FormData对象
    });
}

export function updateDish(dish_id, updatedData) {
    return request({
        url: `/dishes/update`, // 确保与后端路由一致
        method: 'put',
        data: { dish_id, ...updatedData }
    });
}


export function deleteDish(dish_id) {
    return request({
        url: `/dishes/delete/${dish_id}`,
        method: 'delete'
    });
}

export function getAllFeedbacks() {
    return request({
        url: '/dishes/getAllFeedbacks',
        method: 'get'
    });
}


export function getFeedbacksByDishId(dish_id) {
    return request({
        url: `/dishes/getFeedbacksByDishId/${dish_id}`,
        method: 'get'
    });
}

export function submitDishFeedback(token, dish_id, content) {
    return request({
        url: '/dishes/submitFeedback',
        method: 'post',
        headers: {
            Authorization: `Bearer ${token}`
        },
        data: {
            dish_id,
            content
        }
    });
}





